package com.atguigu.juc.test01;

import java.util.concurrent.atomic.AtomicInteger;

public class casDemo {
    public static void main(String[] args) throws InterruptedException {
        AtomicInteger atomicInteger = new AtomicInteger(0);
        for (int i = 0; i < 100 ; i++) {
            new Thread(()->{
                for (int j = 0; j < 100; j++) {
                   System.out.println(Thread.currentThread().getName()+"     :" +atomicInteger.getAndIncrement());

                }
            },"i"+i).start();

        }
            Thread.sleep(100);
        System.out.println(atomicInteger.get());
    }
}
